package com.tangyh.basic.sign.enums;

import com.tangyh.basic.base.BaseEnum;
import io.swagger.annotations.ApiModelProperty;
import java.util.stream.Stream;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @Author: LiXincheng
 * @Description: 个人创建账户 证件类型
 * @Date: 2021/11/25 17:02 
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum EIdentificationType implements BaseEnum {

    CRED_PSN_CH_IDCARD("居民身份证"),
    CRED_PSN_CH_HONGKONG("香港通行证"),
    CRED_PSN_CH_MACAO("澳门通行证"),
    CRED_PSN_CH_TWCARD("台湾通行证"),
    CRED_PSN_PASSPORT("护照"),
    CRED_PSN_FOREIGN("外籍证件"),
    CRED_PSN_CH_SOLDIER_IDCARD("军官证"),
    CRED_PSN_CH_SOCIAL_SECURITY_CARD("社会保障卡"),
    CRED_PSN_CH_ARMED_POLICE_IDCARD("武装警察身份证件"),
    CRED_PSN_CH_RESIDENCE_BOOKLET("户口簿"),
    CRED_PSN_CH_TEMPORARY_IDCARD("临时居民身份证"),
    CRED_PSN_CH_GREEN_CARD("外国人永久居留证"),
    CRED_PSN_SHAREHOLDER_CODE("股东代码证"),
    CRED_PSN_POLICE_ID_CARD("警官证"),
    CRED_PSN_UNKNOWN("未知类型"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static EIdentificationType match(String val, EIdentificationType def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static EIdentificationType get(String val) {
        return match(val, null);
    }

    public boolean eq(EIdentificationType val) {
        return val != null && eq(val.name());
    }

}
